﻿<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<form name="regform" id="regform" method="get">
    请输入搜索字符，以空格区分：<input type="text" size=30 name="kw" value="">
    <input type="submit" value="搜索" name="btnSubmit">
</form>

<?php
$keyword=mb_convert_encoding(htmlspecialchars($_GET[kw]),"GBK","UTF-8");
if ($_GET[kw]!=""){
if(	substr_count($keyword,"\\")||substr_count($keyword,"/")||substr_count($keyword,":")||
	substr_count($keyword,"*") ||substr_count($keyword,"?")||substr_count($keyword,htmlspecialchars("\""))||
	substr_count($keyword,htmlspecialchars('<'))           ||substr_count($keyword,htmlspecialchars('>')) || 
	substr_count($keyword,"?")	) echo "输入非法字符！";
else { //if(输入非法字符！)
if (count!="") $kwd=explode(" ",$keyword,8);
echo "您输入的搜索字串是：";for ($i=0;$i<=count($kwd)-1;$i++) echo mb_convert_encoding($kwd[$i],"UTF-8","GBK")." ";

$st=0;  //显示禁止超过200条
$file_handle = fopen("url.txt", "r");
$url = fgets($file_handle);
while (!feof($file_handle)) {
   for ($i=0;$i<=count($kwd)-1;$i++) {
	if ($kwd[$i]!=""&&(!stripos($url,$kwd[$i],43))) break;
	}
   if ($i==count($kwd)) {
	$st++;$urlG=mb_convert_encoding($url,"UTF-8","GBK");
	echo "<br>".$st.". <a href=ftp://mse:kexie@incoming.blueink.org:40021/".rawurlencode(mb_convert_encoding(substr($urlG,43,strrpos($urlG,"/")-42),"GBK","UTF-8")).' target="_blank">'.substr($urlG,43)."</a><br>";
	}
   if ($st==200) {echo "<br>下面还有喔，但检索到的条目太多，请改进关键词";break;}
   $url = fgets($file_handle);
   }
if ($st==0) echo "<br>居然没有找到！改变关键词试试？";

echo "<br>搜索成功完成";
}//else (输入非法字符！)
}
echo "<br>Incoming.blueink.org FTP Search Engine v0.2. Report bugs to writer greeneleaf6@sina.com";
?>